import java.io.*;
import java.util.Scanner;

/*
 ID: ning yusui
 LANG: JAVA
 TASK: fracdec
 */

public class fracdec {
    Scanner in;
    PrintWriter out;
    public static final int SIZE = 76;
    private int numerator;
    private int denominator;


    public fracdec() throws IOException {
        in = new Scanner(new File(this.getClass().getName() + ".in"));
        out = new PrintWriter(new BufferedWriter(new FileWriter(this.getClass().getName() +
                ".out")));
    }

    private void work() {
        input();
        StringBuilder sb = new StringBuilder(256);
        int head = Math.max(times(denominator, 2), times(denominator, 5));
        sb.append(numerator / denominator).append('.');
        int rem = calcHead(sb, head);
        if (rem != 0) {
            calcRepeat(sb, rem);
        } else if(sb.charAt(sb.length()-1)=='.') {
            resultAppend(sb, '0');
        }
        if(sb.length()>0){
            out.println(sb);
        }
        out.flush();
        out.close();
    }

    private void calcRepeat(StringBuilder sb, int rem) {
        resultAppend(sb, '(');
        int rem2 = rem;
        do {
            rem2 = clacDigit(sb, rem2);
        } while (rem != rem2);
        resultAppend(sb, ')');
    }

    private int calcHead(StringBuilder sb, int head) {
        int rem = numerator % denominator;
        for (int i = 0; i < head; i++) {
            rem = clacDigit(sb, rem);
        }
        return rem;
    }

    private StringBuilder resultAppend(StringBuilder sb, char c) {
        if(sb.length()==SIZE){
            out.println(sb);
            sb.delete(0,sb.length());
        }
        return sb.append(c);
    }

    private StringBuilder resultAppend(StringBuilder sb, int c) {
        return resultAppend(sb,(char) ('0' + c));
    }

    private int clacDigit(StringBuilder sb, int rem) {
        rem *= 10;
        int digit = rem / denominator;
        resultAppend(sb, digit);
        rem = rem % denominator;
        return rem;
    }

    private int times(int a, int b) {
        int t = 0;
        while (a % b == 0) {
            a /= b;
            t++;
        }
        return t;
    }

    private void input() {
        numerator = in.nextInt();
        denominator = in.nextInt();
        int md = gcd(numerator, denominator);
        numerator /= md;
        denominator /= md;
    }

    public static void main(String[] args) throws IOException {
        new fracdec().work();
    }

    private int gcd(int a, int b) {
        int r;
        while ((r = a % b) != 0) {
            a = b;
            b = r;
        }
        return b;
    }
}
